package com.turing.sensivitycode.controller;

import com.turing.common.response.ResponseVO;
import com.turing.common.util.ResponseUtil;
import com.turing.sensivitycode.domain.SensivityLexcion;
import com.turing.sensivitycode.service.SensivityNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 操作敏感词库
 */
@RestController
@RequestMapping(value = "/sensivity")
public class SensivityNameController {




    @Autowired
    private SensivityNameService sensivityNameService;


    /**
     * 创建敏感词库
     * @param lexcionName 词库名称
     * @return
     */
    @PostMapping(value = "/createSensivityLexcion")
    public ResponseVO<Object> createSensivityLexcion(@RequestParam(value = "lexcionName") String lexcionName,@RequestParam(value = "description") String description){
        return ResponseUtil.success(sensivityNameService.createSensivityLexcion(lexcionName,description));
    }

    @GetMapping(value = "/getAllSensivityLexcion")
    public ResponseVO<List<SensivityLexcion>> getAllSensivityLexcion(){
        return ResponseUtil.success(sensivityNameService.getAllSensivityLexcion());
    }

    @GetMapping(value = "/deleteByLexcionID")
    public ResponseVO<String> deleteByLexcionID(@RequestParam(value = "lexcionID") Integer lexcionID){
        return ResponseUtil.success(sensivityNameService.deleteByLexcionID(lexcionID));
    }



}
